<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:mo="https://gitee.com/aun/Timo">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
</head>
<body class="timo-layout-page">
    <div class="layui-card">
        <div class="layui-card-header timo-card-header">
            <span><i class="fa fa-bars"></i> 任务执行查询 </span>
            <i class="layui-icon layui-icon-refresh refresh-btn"></i>
        </div>
        <div class="layui-card-body">
            <div class="layui-row timo-card-screen">
                <div class="pull-left layui-form-pane timo-search-box">
                    <div class="layui-inline">
                        <label class="layui-form-label">应用</label>
                        <div class="layui-input-block timo-search-data">
                            <select name="appId" class="timo-search-select" th:value="${param?.appId}">
                                <option value="">全部</option>
                                <option th:each="item:${apps}" th:text="${item.appName}" th:value="${item.id}" th:selected="${item.id == param?.appId}"></option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">任务</label>
                        <div class="layui-input-block timo-search-data">
                            <select name="jobId" class="timo-search-select" th:value="${param?.jobId}">
                                <option value="">全部</option>
                                <option th:each="item:${jobs}" th:text="${item.jobName}" th:value="${item.id}" th:selected="${item.id == param?.jobId}"></option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">起始时间</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="laydate1" name="startTime" placeholder="yyyy-MM-dd" th:value="${param?.startTime}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">结束时间</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="laydate2" name="endTime" placeholder="yyyy-MM-dd" th:value="${param?.endTime}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn timo-search-btn">
                            <i class="fa fa-search"></i>
                        </button>
                    </div>
                </div>
            </div>
            <div class="timo-table-wrap">
                <table class="layui-table timo-table">
                    <thead>
                    <tr>
                        <th class="sortable" data-field="ID">Id</th>
                        <th class="sortable" data-field="APP_NAME">应用名称</th>
                        <th class="sortable" data-field="JOB_NAME">任务名称</th>
                        <th class="sortable" data-field="ENDPOINT_IP">执行主机</th>
                        <th class="sortable" data-field="ENDPOINT_PORT">执行端口</th>
                        <th class="sortable" data-field="NET_PROTOCOL">执行协议</th>
                        <th class="sortable" data-field="EXECUTE_STATUS">执行状态</th>
                        <th class="sortable" data-field="BEGIN_TIME">开始时间</th>
                        <th class="sortable" data-field="END_TIME">结束时间</th>
                        <th>详细信息</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="item:${list}">
                        <td><a th:href="@{'/admin/quartz/job/execute/executeLog/'+${item.ID}}" target="_blank" th:text="${item.ID}"></a></td>
                        <td th:text="${item.NAME}">应用名称</td>
                        <td th:text="${item.JOB_NAME}">任务名称</td>
                        <td th:text="${item.ENDPOINT_IP}">执行主机</td>
                        <td th:text="${item.ENDPOINT_PORT}">执行端口</td>
                        <td th:text="${#dicts.keyValue('NET_PROTOCOL', item.NET_PROTOCOL)}">执行协议</td>
                        <td>
                            <span th:text="${#dicts.keyValue('EXECUTE_STATUS', item.EXECUTE_STATUS)}" th:classappend="${item.EXECUTE_STATUS ne '0000' && item.EXECUTE_STATUS ne '0002'} ? 'layui-btn layui-btn-sm layui-btn-danger'"></span>
                        </td>
                        <td th:text="${#dates.format(item.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss')}">开始时间</td>
                        <td th:text="${#dates.format(item.END_TIME, 'yyyy-MM-dd HH:mm:ss')}">结束时间</td>
                        <td>
                            <a class="open-popup" data-title="详细信息" th:attr="data-url=@{'/admin/quartz/job/execute/info/'+${item.ID}}"  data-size="1200,700" href="#">详细信息</a>
                        </td>
                        <td>
                            <a th:if="${item.EXECUTE_STATUS eq '1002'}" class="ajax-get" data-msg="您是否确认结束执行" th:href="@{'/log/cancel?executeLogId='+${item.ID}}">结束执行</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div th:replace="/common/fragment :: page"></div>
        </div>
    </div>
<script th:replace="/common/template :: script"></script>
    <script type="text/javascript" th:src="@{/js/triggerLog.js}"></script>
</body>
</html>